<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="text" @keypress="getmessage" v-model="message" />
    </div>
    <script>
        // keyup  keydown keypress
        // altKey
        // keyCode:ASSCI --->key :字母
        // 按键修饰符：
        // 1.ASSCI  2.简写
        // 组合按键
        /* 
          
              .enter
              .tab
              .delete (捕获“删除”和“退格”键)
              .esc
              .space
              .up
              .down
              .left
              .right
          
          */
        new Vue({
            el: "#app",
            data: {
                message: "",
            },
            methods: {
                //keypress渲染需要时间，加入定时器会马上执行
                getmessage() {
                    setTimeout(() => {
                        console.log(this.message);
                    });
                },
            },
        });

        // this.$nextTick(() => {
        //     console.log(this.message);
        // });
        // setTimeout(() => {
        //     //keypress渲染需要时间，加入定时器会马上执行
        //     console.log(this.message);
    </script>
</body>

</html>